-
Notifications
You must be signed in to change notification settings - Fork 114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LG-14010 - More detailed error page for Socure errors #11560
base: main
Are you sure you want to change the base?
LG-14010 - More detailed error page for Socure errors #11560
Conversation
Added plumbing and UX display for categorized Socure errors. changelog Upcoming Features, Socure, Added nice error displays
changelog: Upcoming Features, Socure, Added nice error display for Socure failures
form_response_params[:extra] = extra unless extra.nil? | ||
FormResponse.new(**form_response_params) | ||
end | ||
|
||
def make_error_hash(message) | ||
Rails.logger.info("make_error_hash: stored_result: #{stored_result.inspect}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are we intending to log this?
def failure(message, extra = nil) | ||
flash[:error] = message | ||
form_response_params = { success: false, errors: { message: message } } | ||
def failure(message = nil, extra = nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it appear that failure is only called once passing message as nil. i understand this is following the pattern for defining the failure method throughout the application; however, could it be worth eliminating this failure method definition and instead of calling it use the below
FormResponse.new(
{
success: false,
errors: make_error_hash(message),
extra: extra}
}.compact
)
error_hash = { message: message || I18n.t('doc_auth.errors.general.network_error') } | ||
|
||
if stored_result&.errors&.has_key?(:socure) | ||
error_hash[:socure] = stored_result.errors[:socure] | ||
end | ||
|
||
error_hash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
error_hash = { message: message || I18n.t('doc_auth.errors.general.network_error') } | |
if stored_result&.errors&.has_key?(:socure) | |
error_hash[:socure] = stored_result.errors[:socure] | |
end | |
error_hash | |
{ | |
message: message || I18n.t('doc_auth.errors.general.network_error'), | |
socure: stored_result&.errors&.dig(:socure) | |
}.compact |
this seems simpler to me, just a suggestion
@@ -34,6 +34,7 @@ class DocvResultResponse < DocAuth::Response | |||
|
|||
def initialize(http_response:, biometric_comparison_required: false) | |||
@http_response = http_response | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
else | ||
icon_name = :warning | ||
end | ||
|
||
troubleshooting_heading = local_assigns.fetch(:troubleshooting_heading) do | ||
if local_assigns.fetch(:type, :error) == :error | ||
troubleshooting_heading = t('idv.troubleshooting.headings.need_assistance') | ||
else | ||
troubleshooting_heading = t('components.troubleshooting_options.default_heading') | ||
end | ||
end | ||
%> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there a reason to change this and add new lines? 🤔
@presenter = socure_errors_presenter(handle_stored_result) | ||
end | ||
|
||
def goto_in_person |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
having the controller action inside of the concern feels a bit buried 🤔 i didn't realize this was a controller action until I saw the routes file 😬
verify_info_controller#update has a pattern worth considering
form_response_params[:extra] = extra unless extra.nil? | ||
FormResponse.new(**form_response_params) | ||
end | ||
|
||
def make_error_hash(message) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def make_error_hash(message) | |
def error_hash(message) |
if remapped_error(error_code) == 'underage' # special handling because it says 'Login.gov' | ||
I18n.t('doc_auth.errors.underage', app_name: APP_NAME) | ||
else | ||
# i18n-tasks-use t('doc_auth.errors.unreadable_id') | ||
# i18n-tasks-use t('doc_auth.errors.unaccepted_id_type') | ||
# i18n-tasks-use t('doc_auth.errors.expired_id') | ||
# i18n-tasks-use t('doc_auth.errors.low_resolution') | ||
# i18n-tasks-use t('doc_auth.errors.id_not_found') | ||
I18n.t("doc_auth.errors.#{remapped_error(error_code)}") | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if remapped_error(error_code) == 'underage' # special handling because it says 'Login.gov' | |
I18n.t('doc_auth.errors.underage', app_name: APP_NAME) | |
else | |
# i18n-tasks-use t('doc_auth.errors.unreadable_id') | |
# i18n-tasks-use t('doc_auth.errors.unaccepted_id_type') | |
# i18n-tasks-use t('doc_auth.errors.expired_id') | |
# i18n-tasks-use t('doc_auth.errors.low_resolution') | |
# i18n-tasks-use t('doc_auth.errors.id_not_found') | |
I18n.t("doc_auth.errors.#{remapped_error(error_code)}") | |
end | |
remapped_error_code = remapped_error(error_code) | |
if remapped_error_code == 'underage' # special handling because it says 'Login.gov' | |
I18n.t('doc_auth.errors.underage', app_name: APP_NAME) | |
else | |
# i18n-tasks-use t('doc_auth.errors.unreadable_id') | |
# i18n-tasks-use t('doc_auth.errors.unaccepted_id_type') | |
# i18n-tasks-use t('doc_auth.errors.expired_id') | |
# i18n-tasks-use t('doc_auth.errors.low_resolution') | |
# i18n-tasks-use t('doc_auth.errors.id_not_found') | |
I18n.t("doc_auth.errors.#{remapped_error_code}") | |
end |
get '/hybrid_mobile/socure/document_capture_errors' => 'hybrid_mobile/socure/document_capture#errors', as: :hybrid_mobile_socure_document_capture_errors | ||
get '/hybrid_mobile/socure/document_capture_goto_in_person' => 'hybrid_mobile/socure/document_capture#goto_in_person', as: :hybrid_mobile_socure_document_capture_goto_in_person |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
get '/hybrid_mobile/socure/document_capture_errors' => 'hybrid_mobile/socure/document_capture#errors', as: :hybrid_mobile_socure_document_capture_errors | |
get '/hybrid_mobile/socure/document_capture_goto_in_person' => 'hybrid_mobile/socure/document_capture#goto_in_person', as: :hybrid_mobile_socure_document_capture_goto_in_person | |
get '/hybrid_mobile/socure/errors/warning' => 'hybrid_mobile/socure/document_capture#errors', as: :hybrid_mobile_socure_document_capture_errors | |
get '/hybrid_mobile/socure/errors/in_person' => 'hybrid_mobile/socure/document_capture#goto_in_person', as: :hybrid_mobile_socure_document_capture_goto_in_person |
looking at how we handle errors for other idv checks ... it seems like they generally have a errors controller. what do you think about following this pattern?
Added plumbing and UX display for categorized Socure errors.
changelog Upcoming Features, Socure, Added nice error displays
🎫 Ticket
Link to the relevant ticket:
LG-14010
🛠 Summary of changes
Passed the Socure errors through from the original DocV response back through the document capture result, then added a presenter and updated error page to display it all nicely.
📜 Testing Plan
This test procedure requires a sandbox set up to use Socure. See jmax
or Doug to coordinate use of one.
/srv/idp/current/app/services/doc_auth/socure/responses/docv_result_response.rb
. Insertthe following lines after line 36:
Exit the SSM sesion and reboot Puma
Connect to the IDP, create an account, and begin IdV. Verify that
you end up on the Category 1 error page.
Cancel out of IdV and return to your account page.
SSM into the sandbox and modify the above file once again. Change the error code from 'I848' to 'I849'.
Exit the SSM session and reboot Puma
Connect to the IDP, create an account, and begin IdV. Verify that
you end up on the Category 2 error page.
Cancel out of IdV and return to your account page.
SSM into the sandbox and modify the above file once again. Change the error code from 'I849' to 'R827'.
Exit the SSM session and reboot Puma
Connect to the IDP, create an account, and begin IdV. Verify that
you end up on the Category 3 error page.
Cancel out of IdV and return to your account page.
SSM into the sandbox and modify the above file once again. Change the error code from 'R827' to 'I808'.
Exit the SSM session and reboot Puma
Connect to the IDP, create an account, and begin IdV. Verify that
you end up on the Category 4 error page.
Cancel out of IdV and return to your account page.
SSM into the sandbox and modify the above file once again. Change the error code from 'I808' to 'R845'.
Exit the SSM session and reboot Puma
Connect to the IDP, create an account, and begin IdV. Verify that
you end up on the Category 5 error page.
Cancel out of IdV and return to your account page.
SSM into the sandbox and modify the above file once again. Change the error code from 'R845' to 'I856'.
Exit the SSM session and reboot Puma
Connect to the IDP, create an account, and begin IdV. Verify that
you end up on the Category 6 error page.
Cancel out of IdV and return to your account page.
SSM into the sandbox and modify the above file once again. This
time, remove the error code line completely and replace it with
raise "Some error"
Exit the SSM session and reboot Puma
Connect to the IDP, create an account, and begin IdV. Verify that
you end up on the Category 7 error page.
Cancel out of IdV, return to your account page, and log out.
👀 Screenshots
If relevant, include a screenshot or screen capture of the changes.
Category 1 error page
Category 2 error page
Category 3 error page
Category 4 error page
Category 5 error page
Category 6 errpr page
Category 7 error page